const RandomDecarator:PropertyDecorator = (target: Object, propertyKey: string | symbol) => {
    const colors:string[] = ['red','orange','yellow','green','blue','purple'];
    Object.defineProperty(target,propertyKey,{
        get:() => {
            return colors[Math.floor(Math.random()*colors.length)]
        }
    })
}

class Color{
    @RandomDecarator
    public color:string|undefined
    public draw(){
        document.body.insertAdjacentHTML('beforeend',`<div style="width=200px;height=200px;background-color:${this.color};">6758</div>`)
    }
}

new Color().draw()